<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.12"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>emp-toolkit: /Users/wangxiao/git/emp-toolkit/emp-tool/circuits/integer.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="logo-full-doxygen.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">emp-toolkit
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.12 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('integer_8h_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">integer.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="integer_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#ifndef INTEGER_H__</span></div><div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#define INTEGER_H__</span></div><div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;</div><div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="bit_8h.html">bit.h</a>&quot;</span></div><div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="number_8h.html">number.h</a>&quot;</span></div><div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="comparable_8h.html">comparable.h</a>&quot;</span></div><div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="swappable_8h.html">swappable.h</a>&quot;</span></div><div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div><div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;algorithm&gt;</span></div><div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="preprocessor">#include &lt;math.h&gt;</span></div><div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="keyword">using</span> std::vector;</div><div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="keyword">using</span> std::min;</div><div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="class_integer.html">   14</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_integer.html">Integer</a> : <span class="keyword">public</span> <a class="code" href="class_swappable.html">Swappable</a>&lt;Integer&gt;, <span class="keyword">public</span> <a class="code" href="class_comparable.html">Comparable</a>&lt;Integer&gt; { <span class="keyword">public</span>:</div><div class="line"><a name="l00015"></a><span class="lineno"><a class="line" href="class_integer.html#ae3847c40ec52f0dbef88a0db4321c897">   15</a></span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_integer.html#ae3847c40ec52f0dbef88a0db4321c897">length</a> = 0;</div><div class="line"><a name="l00016"></a><span class="lineno"><a class="line" href="class_integer.html#ab846e7fad6c33de70273c7698e1a1bd7">   16</a></span>&#160;    <a class="code" href="class_bit.html">Bit</a>* <a class="code" href="class_integer.html#ab846e7fad6c33de70273c7698e1a1bd7">bits</a> = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="class_integer.html#a6cf1eca614267c9a78a9d45b4dbb0bf6">   17</a></span>&#160;    <a class="code" href="class_integer.html#a6cf1eca614267c9a78a9d45b4dbb0bf6">Integer</a>(<a class="code" href="class_integer.html">Integer</a>&amp;&amp; in) : length(in.length) {</div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;        bits = in.bits;</div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;        in.bits = <span class="keyword">nullptr</span>;</div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    }</div><div class="line"><a name="l00021"></a><span class="lineno"><a class="line" href="class_integer.html#ac8d9feb53e0ba3eba9a476cf274bb295">   21</a></span>&#160;    <a class="code" href="class_integer.html#ac8d9feb53e0ba3eba9a476cf274bb295">Integer</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; in): length(in.length) {</div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;        bits = <span class="keyword">new</span> <a class="code" href="class_bit.html">Bit</a>[<a class="code" href="class_integer.html#ae3847c40ec52f0dbef88a0db4321c897">length</a>];</div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;        memcpy(bits, in.<a class="code" href="class_integer.html#ab846e7fad6c33de70273c7698e1a1bd7">bits</a>, <span class="keyword">sizeof</span>(<a class="code" href="class_bit.html">Bit</a>)*length);</div><div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;    }</div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="class_integer.html#a144df83f92bf2b256d0243213a507c39">   25</a></span>&#160;    <a class="code" href="class_integer.html">Integer</a>&amp; <a class="code" href="class_integer.html#a144df83f92bf2b256d0243213a507c39">operator= </a>(<a class="code" href="class_integer.html">Integer</a> rhs){</div><div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;        length = rhs.<a class="code" href="class_integer.html#ae3847c40ec52f0dbef88a0db4321c897">length</a>;</div><div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;        <a class="code" href="swappable_8h.html#a4043c520b57fcca7b1eaa03102828a0a">std::swap</a>(bits, rhs.<a class="code" href="class_integer.html#ab846e7fad6c33de70273c7698e1a1bd7">bits</a>);</div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;        <span class="keywordflow">return</span> *<span class="keyword">this</span>;</div><div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;    }</div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="class_integer.html#aed61fd31fd11ce0c39a41385e2c66135">   30</a></span>&#160;    <a class="code" href="class_integer.html#aed61fd31fd11ce0c39a41385e2c66135">Integer</a>(<span class="keywordtype">int</span> len, <span class="keyword">const</span> <span class="keywordtype">void</span> * b) : length(len) {</div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;        bits = <span class="keyword">new</span> <a class="code" href="class_bit.html">Bit</a>[len];</div><div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        memcpy(bits, b, <span class="keyword">sizeof</span>(<a class="code" href="class_bit.html">Bit</a>)*len);</div><div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160;    }</div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="class_integer.html#ae1e48416e8f1b652464daac1132ece50">   34</a></span>&#160;    <a class="code" href="class_integer.html#ae1e48416e8f1b652464daac1132ece50">~Integer</a>() {</div><div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;        <span class="keywordflow">if</span> (bits!=<span class="keyword">nullptr</span>) <span class="keyword">delete</span>[] <a class="code" href="class_integer.html#ab846e7fad6c33de70273c7698e1a1bd7">bits</a>;</div><div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;    }</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <a class="code" href="class_integer.html#a7fcab0564d7270017ebcca55bae1a17a">Integer</a>(<span class="keywordtype">int</span> length, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; str, <span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a> = <a class="code" href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a>);</div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <a class="code" href="class_integer.html#a7fcab0564d7270017ebcca55bae1a17a">Integer</a>(<span class="keywordtype">int</span> length, <span class="keywordtype">long</span> <span class="keywordtype">long</span> input, <span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a> = <a class="code" href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a>);</div><div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="class_integer.html#a7fcab0564d7270017ebcca55bae1a17a">   40</a></span>&#160;    <a class="code" href="class_integer.html#a7fcab0564d7270017ebcca55bae1a17a">Integer</a>() :length(0),bits(nullptr){ }</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;<span class="comment">//Comparable</span></div><div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_integer.html#ac4ed80fec82664aa1601eba27594c38c">geq</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &amp; rhs) <span class="keyword">const</span>;</div><div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;    <a class="code" href="class_bit.html">Bit</a> <a class="code" href="class_integer.html#a9efc9effda411caa918d674b2d62ee31">equal</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &amp; rhs) <span class="keyword">const</span>;</div><div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;</div><div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;<span class="comment">//Swappable</span></div><div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a06dcad181ffb0d7fc83c5cb8f0ad1561">select</a>(<span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a> &amp; sel, <span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a> &amp; rhs) <span class="keyword">const</span>;</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a42fb72b76ab215d41e205b2c08dc8068">operator^</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs) <span class="keyword">const</span>;</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <span class="keywordtype">int</span> <a class="code" href="class_integer.html#af2ab5650c234f514ee6b223a50178737">size</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span> O&gt;</div><div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    O <a class="code" href="class_integer.html#a46c3a539863fb2ff610a4d6ef61b9367">reveal</a>(<span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a>=<a class="code" href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a>) <span class="keyword">const</span>;</div><div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#ac6bdcb2c326485873b4797ae3b4aea80">abs</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    <a class="code" href="class_integer.html">Integer</a>&amp; <a class="code" href="class_integer.html#a4f3c2fa68e1a235b05a42b337fcd301f">resize</a>(<span class="keywordtype">int</span> length, <span class="keywordtype">bool</span> signed_extend = <span class="keyword">true</span>);</div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#ae83a5635db28d3d991765bd83485504b">modExp</a>(<a class="code" href="class_integer.html">Integer</a> p, <a class="code" href="class_integer.html">Integer</a> q);</div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a40379b494d4d66d0cbeddc0d72310edc">leading_zeros</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#ad5081395086bc1000461897302ac849c">hamming_weight</a>() <span class="keyword">const</span>;</div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a5ffac1d06e3bdae739930cc67e469862">operator&lt;&lt;</a>(<span class="keywordtype">int</span> shamt)<span class="keyword">const</span>;</div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a14e0161c98f6e56b5b755ff4fd42b3c7">operator&gt;&gt;</a>(<span class="keywordtype">int</span> shamt)<span class="keyword">const</span>;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a5ffac1d06e3bdae739930cc67e469862">operator&lt;&lt;</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; shamt)<span class="keyword">const</span>;</div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a14e0161c98f6e56b5b755ff4fd42b3c7">operator&gt;&gt;</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; shamt)<span class="keyword">const</span>;</div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;</div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#add01c8e047399235778c6544c4c8003e">operator+</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs)<span class="keyword">const</span>;</div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a2ea2f60e46acea85fa4dd414dd9f9435">operator-</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs)<span class="keyword">const</span>;</div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a2ea2f60e46acea85fa4dd414dd9f9435">operator-</a>()<span class="keyword">const</span>;</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a47e4187efe2c7f139949086e49b315f3">operator*</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs)<span class="keyword">const</span>;</div><div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a5ebd6bf49e343f8337ba738c686fa7ed">operator/</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs)<span class="keyword">const</span>;</div><div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#a5c75efb73decdd1766874ec0db124b82">operator%</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs)<span class="keyword">const</span>;</div><div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#af51305440bdcab7836f4bd10ed25ee31">operator&amp;</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs)<span class="keyword">const</span>;</div><div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <a class="code" href="class_integer.html">Integer</a> <a class="code" href="class_integer.html#aec3c01bf663d63303ac3357617c07dbb">operator|</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html">Integer</a>&amp; rhs)<span class="keyword">const</span>;</div><div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;</div><div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160;    <a class="code" href="class_bit.html">Bit</a>&amp; <a class="code" href="class_integer.html#a02e2cb977881d0838d372d52b1273acf">operator[]</a>(<span class="keywordtype">int</span> index);</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keyword">const</span> <a class="code" href="class_bit.html">Bit</a> &amp; <a class="code" href="class_integer.html#a02e2cb977881d0838d372d52b1273acf">operator[]</a>(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    </div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;<span class="comment">//batcher</span></div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="keyword">template</span>&lt;<span class="keyword">typename</span>... Args&gt;</div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="class_integer.html#a953c5af4d91a156d80ae60d20165f2de">   79</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">size_t</span> <a class="code" href="class_integer.html#a953c5af4d91a156d80ae60d20165f2de">bool_size</a>(<span class="keywordtype">size_t</span> size, Args... args) {</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="keywordflow">return</span> <a class="code" href="class_integer.html#af2ab5650c234f514ee6b223a50178737">size</a>;</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    }</div><div class="line"><a name="l00082"></a><span class="lineno"><a class="line" href="class_integer.html#ad025e3752cf6cc06e0f7bf247a3d8f62">   82</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_integer.html#ad025e3752cf6cc06e0f7bf247a3d8f62">bool_data</a>(<span class="keywordtype">bool</span>* data, <span class="keywordtype">size_t</span> len, <span class="keywordtype">long</span> <span class="keywordtype">long</span> num) {</div><div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        <a class="code" href="class_integer.html#ad025e3752cf6cc06e0f7bf247a3d8f62">bool_data</a>(data, len, std::to_string(num));</div><div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    }</div><div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="class_integer.html#a43c8ef64c8d1b94a6826f7405cce30b8">   85</a></span>&#160;    <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="class_integer.html#a43c8ef64c8d1b94a6826f7405cce30b8">bool_data</a>(<span class="keywordtype">bool</span>* data, <span class="keywordtype">size_t</span> len, <span class="keywordtype">string</span> str) {</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;        <span class="keywordtype">string</span> bin = <a class="code" href="utils_8h.html#ab1365290cf96c96e6d3271bc3f4e913e">dec_to_bin</a>(str);</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;        std::reverse(bin.begin(), bin.end());</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;<span class="comment">//      cout &lt;&lt; &quot;convert &quot; &lt;&lt;str&lt;&lt;&quot; &quot;&lt;&lt;bin&lt;&lt;endl;</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;        <span class="keywordtype">int</span> l = (bin.size() &gt; (size_t)len ? len : bin.size());</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;        <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i = 0; i &lt; l; ++i)</div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;            data[i] = (bin[i] == <span class="charliteral">&#39;1&#39;</span>);</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;        <span class="keywordflow">for</span> (<span class="keywordtype">size_t</span> i = l; i &lt; len; ++i)</div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;            data[i] = data[l-1];</div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    }</div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;};</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="keywordtype">void</span> <a class="code" href="integer_8h.html#aa078bbb5ca309f00b82f3003aefd85bf">init</a>(<a class="code" href="class_bit.html">Bit</a> * <a class="code" href="class_integer.html#ab846e7fad6c33de70273c7698e1a1bd7">bits</a>, <span class="keyword">const</span> <span class="keywordtype">bool</span>* b, <span class="keywordtype">int</span> <a class="code" href="class_integer.html#ae3847c40ec52f0dbef88a0db4321c897">length</a>, <span class="keywordtype">int</span> <a class="code" href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a> = <a class="code" href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a>);</div><div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="integer_8hpp.html">integer.hpp</a>&quot;</span></div><div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="preprocessor">#endif// INTEGER_H__</span></div><div class="ttc" id="class_integer_html_aed61fd31fd11ce0c39a41385e2c66135"><div class="ttname"><a href="class_integer.html#aed61fd31fd11ce0c39a41385e2c66135">Integer::Integer</a></div><div class="ttdeci">Integer(int len, const void *b)</div><div class="ttdef"><b>Definition:</b> integer.h:30</div></div>
<div class="ttc" id="class_integer_html_a9efc9effda411caa918d674b2d62ee31"><div class="ttname"><a href="class_integer.html#a9efc9effda411caa918d674b2d62ee31">Integer::equal</a></div><div class="ttdeci">Bit equal(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:305</div></div>
<div class="ttc" id="integer_8hpp_html"><div class="ttname"><a href="integer_8hpp.html">integer.hpp</a></div></div>
<div class="ttc" id="utils_8h_html_ab1365290cf96c96e6d3271bc3f4e913e"><div class="ttname"><a href="utils_8h.html#ab1365290cf96c96e6d3271bc3f4e913e">dec_to_bin</a></div><div class="ttdeci">string dec_to_bin(const string &amp;dec)</div><div class="ttdef"><b>Definition:</b> utils.h:68</div></div>
<div class="ttc" id="comparable_8h_html"><div class="ttname"><a href="comparable_8h.html">comparable.h</a></div></div>
<div class="ttc" id="class_integer_html_add01c8e047399235778c6544c4c8003e"><div class="ttname"><a href="class_integer.html#add01c8e047399235778c6544c4c8003e">Integer::operator+</a></div><div class="ttdeci">Integer operator+(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:314</div></div>
<div class="ttc" id="class_integer_html_a43c8ef64c8d1b94a6826f7405cce30b8"><div class="ttname"><a href="class_integer.html#a43c8ef64c8d1b94a6826f7405cce30b8">Integer::bool_data</a></div><div class="ttdeci">static void bool_data(bool *data, size_t len, string str)</div><div class="ttdef"><b>Definition:</b> integer.h:85</div></div>
<div class="ttc" id="class_integer_html_ac4ed80fec82664aa1601eba27594c38c"><div class="ttname"><a href="class_integer.html#ac4ed80fec82664aa1601eba27594c38c">Integer::geq</a></div><div class="ttdeci">Bit geq(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:294</div></div>
<div class="ttc" id="integer_8h_html_aa078bbb5ca309f00b82f3003aefd85bf"><div class="ttname"><a href="integer_8h.html#aa078bbb5ca309f00b82f3003aefd85bf">init</a></div><div class="ttdeci">void init(Bit *bits, const bool *b, int length, int party=PUBLIC)</div><div class="ttdef"><b>Definition:</b> integer.hpp:125</div></div>
<div class="ttc" id="class_integer_html_ac8d9feb53e0ba3eba9a476cf274bb295"><div class="ttname"><a href="class_integer.html#ac8d9feb53e0ba3eba9a476cf274bb295">Integer::Integer</a></div><div class="ttdeci">Integer(const Integer &amp;in)</div><div class="ttdef"><b>Definition:</b> integer.h:21</div></div>
<div class="ttc" id="class_comparable_html"><div class="ttname"><a href="class_comparable.html">Comparable</a></div><div class="ttdef"><b>Definition:</b> comparable.h:5</div></div>
<div class="ttc" id="class_integer_html_a5ebd6bf49e343f8337ba738c686fa7ed"><div class="ttname"><a href="class_integer.html#a5ebd6bf49e343f8337ba738c686fa7ed">Integer::operator/</a></div><div class="ttdeci">Integer operator/(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:333</div></div>
<div class="ttc" id="class_integer_html_a47e4187efe2c7f139949086e49b315f3"><div class="ttname"><a href="class_integer.html#a47e4187efe2c7f139949086e49b315f3">Integer::operator*</a></div><div class="ttdeci">Integer operator*(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:327</div></div>
<div class="ttc" id="class_integer_html_a144df83f92bf2b256d0243213a507c39"><div class="ttname"><a href="class_integer.html#a144df83f92bf2b256d0243213a507c39">Integer::operator=</a></div><div class="ttdeci">Integer &amp; operator=(Integer rhs)</div><div class="ttdef"><b>Definition:</b> integer.h:25</div></div>
<div class="ttc" id="class_integer_html_a4f3c2fa68e1a235b05a42b337fcd301f"><div class="ttname"><a href="class_integer.html#a4f3c2fa68e1a235b05a42b337fcd301f">Integer::resize</a></div><div class="ttdeci">Integer &amp; resize(int length, bool signed_extend=true)</div><div class="ttdef"><b>Definition:</b> integer.hpp:215</div></div>
<div class="ttc" id="class_integer_html_aec3c01bf663d63303ac3357617c07dbb"><div class="ttname"><a href="class_integer.html#aec3c01bf663d63303ac3357617c07dbb">Integer::operator|</a></div><div class="ttdeci">Integer operator|(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:235</div></div>
<div class="ttc" id="class_integer_html_a02e2cb977881d0838d372d52b1273acf"><div class="ttname"><a href="class_integer.html#a02e2cb977881d0838d372d52b1273acf">Integer::operator[]</a></div><div class="ttdeci">Bit &amp; operator[](int index)</div><div class="ttdef"><b>Definition:</b> integer.hpp:162</div></div>
<div class="ttc" id="utils_8h_html_ad17d551e31d1828c68acf40684849b7e"><div class="ttname"><a href="utils_8h.html#ad17d551e31d1828c68acf40684849b7e">PUBLIC</a></div><div class="ttdeci">#define PUBLIC</div><div class="ttdef"><b>Definition:</b> utils.h:14</div></div>
<div class="ttc" id="class_integer_html_ad025e3752cf6cc06e0f7bf247a3d8f62"><div class="ttname"><a href="class_integer.html#ad025e3752cf6cc06e0f7bf247a3d8f62">Integer::bool_data</a></div><div class="ttdeci">static void bool_data(bool *data, size_t len, long long num)</div><div class="ttdef"><b>Definition:</b> integer.h:82</div></div>
<div class="ttc" id="class_integer_html_a14e0161c98f6e56b5b755ff4fd42b3c7"><div class="ttname"><a href="class_integer.html#a14e0161c98f6e56b5b755ff4fd42b3c7">Integer::operator&gt;&gt;</a></div><div class="ttdeci">Integer operator&gt;&gt;(int shamt) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:264</div></div>
<div class="ttc" id="class_integer_html_ac6bdcb2c326485873b4797ae3b4aea80"><div class="ttname"><a href="class_integer.html#ac6bdcb2c326485873b4797ae3b4aea80">Integer::abs</a></div><div class="ttdeci">Integer abs() const</div><div class="ttdef"><b>Definition:</b> integer.hpp:208</div></div>
<div class="ttc" id="class_integer_html_a42fb72b76ab215d41e205b2c08dc8068"><div class="ttname"><a href="class_integer.html#a42fb72b76ab215d41e205b2c08dc8068">Integer::operator^</a></div><div class="ttdeci">Integer operator^(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:228</div></div>
<div class="ttc" id="class_integer_html_ae1e48416e8f1b652464daac1132ece50"><div class="ttname"><a href="class_integer.html#ae1e48416e8f1b652464daac1132ece50">Integer::~Integer</a></div><div class="ttdeci">~Integer()</div><div class="ttdef"><b>Definition:</b> integer.h:34</div></div>
<div class="ttc" id="class_integer_html_a7fcab0564d7270017ebcca55bae1a17a"><div class="ttname"><a href="class_integer.html#a7fcab0564d7270017ebcca55bae1a17a">Integer::Integer</a></div><div class="ttdeci">Integer()</div><div class="ttdef"><b>Definition:</b> integer.h:40</div></div>
<div class="ttc" id="class_integer_html_af2ab5650c234f514ee6b223a50178737"><div class="ttname"><a href="class_integer.html#af2ab5650c234f514ee6b223a50178737">Integer::size</a></div><div class="ttdeci">int size() const</div><div class="ttdef"><b>Definition:</b> integer.hpp:203</div></div>
<div class="ttc" id="class_swappable_html"><div class="ttname"><a href="class_swappable.html">Swappable</a></div><div class="ttdef"><b>Definition:</b> swappable.h:7</div></div>
<div class="ttc" id="swappable_8h_html_a4043c520b57fcca7b1eaa03102828a0a"><div class="ttname"><a href="swappable_8h.html#a4043c520b57fcca7b1eaa03102828a0a">swap</a></div><div class="ttdeci">void swap(const Bit &amp;swap, T &amp;o1, T &amp;o2)</div><div class="ttdef"><b>Definition:</b> swappable.h:18</div></div>
<div class="ttc" id="class_integer_html"><div class="ttname"><a href="class_integer.html">Integer</a></div><div class="ttdef"><b>Definition:</b> integer.h:14</div></div>
<div class="ttc" id="class_integer_html_af51305440bdcab7836f4bd10ed25ee31"><div class="ttname"><a href="class_integer.html#af51305440bdcab7836f4bd10ed25ee31">Integer::operator &amp;</a></div><div class="ttdeci">Integer operator &amp;(const Integer &amp;rhs) const</div></div>
<div class="ttc" id="number_8h_html"><div class="ttname"><a href="number_8h.html">number.h</a></div></div>
<div class="ttc" id="class_integer_html_a5ffac1d06e3bdae739930cc67e469862"><div class="ttname"><a href="class_integer.html#a5ffac1d06e3bdae739930cc67e469862">Integer::operator&lt;&lt;</a></div><div class="ttdeci">Integer operator&lt;&lt;(int shamt) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:249</div></div>
<div class="ttc" id="class_integer_html_ae83a5635db28d3d991765bd83485504b"><div class="ttname"><a href="class_integer.html#ae83a5635db28d3d991765bd83485504b">Integer::modExp</a></div><div class="ttdeci">Integer modExp(Integer p, Integer q)</div><div class="ttdef"><b>Definition:</b> integer.hpp:391</div></div>
<div class="ttc" id="class_integer_html_a40379b494d4d66d0cbeddc0d72310edc"><div class="ttname"><a href="class_integer.html#a40379b494d4d66d0cbeddc0d72310edc">Integer::leading_zeros</a></div><div class="ttdeci">Integer leading_zeros() const</div><div class="ttdef"><b>Definition:</b> integer.hpp:357</div></div>
<div class="ttc" id="class_bit_html"><div class="ttname"><a href="class_bit.html">Bit</a></div><div class="ttdef"><b>Definition:</b> bit.h:8</div></div>
<div class="ttc" id="class_integer_html_ad5081395086bc1000461897302ac849c"><div class="ttname"><a href="class_integer.html#ad5081395086bc1000461897302ac849c">Integer::hamming_weight</a></div><div class="ttdeci">Integer hamming_weight() const</div><div class="ttdef"><b>Definition:</b> integer.hpp:367</div></div>
<div class="ttc" id="class_integer_html_a953c5af4d91a156d80ae60d20165f2de"><div class="ttname"><a href="class_integer.html#a953c5af4d91a156d80ae60d20165f2de">Integer::bool_size</a></div><div class="ttdeci">static size_t bool_size(size_t size, Args... args)</div><div class="ttdef"><b>Definition:</b> integer.h:79</div></div>
<div class="ttc" id="class_integer_html_ae3847c40ec52f0dbef88a0db4321c897"><div class="ttname"><a href="class_integer.html#ae3847c40ec52f0dbef88a0db4321c897">Integer::length</a></div><div class="ttdeci">int length</div><div class="ttdef"><b>Definition:</b> integer.h:15</div></div>
<div class="ttc" id="class_integer_html_a5c75efb73decdd1766874ec0db124b82"><div class="ttname"><a href="class_integer.html#a5c75efb73decdd1766874ec0db124b82">Integer::operator%</a></div><div class="ttdeci">Integer operator%(const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:342</div></div>
<div class="ttc" id="class_integer_html_a46c3a539863fb2ff610a4d6ef61b9367"><div class="ttname"><a href="class_integer.html#a46c3a539863fb2ff610a4d6ef61b9367">Integer::reveal</a></div><div class="ttdeci">O reveal(int party=PUBLIC) const</div></div>
<div class="ttc" id="bit_8h_html"><div class="ttname"><a href="bit_8h.html">bit.h</a></div></div>
<div class="ttc" id="class_integer_html_a06dcad181ffb0d7fc83c5cb8f0ad1561"><div class="ttname"><a href="class_integer.html#a06dcad181ffb0d7fc83c5cb8f0ad1561">Integer::select</a></div><div class="ttdeci">Integer select(const Bit &amp;sel, const Integer &amp;rhs) const</div><div class="ttdef"><b>Definition:</b> integer.hpp:155</div></div>
<div class="ttc" id="input-check-malicious_8cpp_html_aefdd5aa9f02e7cb8d21ea22b0e6b03df"><div class="ttname"><a href="input-check-malicious_8cpp.html#aefdd5aa9f02e7cb8d21ea22b0e6b03df">party</a></div><div class="ttdeci">int party</div><div class="ttdef"><b>Definition:</b> input-check-malicious.cpp:12</div></div>
<div class="ttc" id="class_integer_html_ab846e7fad6c33de70273c7698e1a1bd7"><div class="ttname"><a href="class_integer.html#ab846e7fad6c33de70273c7698e1a1bd7">Integer::bits</a></div><div class="ttdeci">Bit * bits</div><div class="ttdef"><b>Definition:</b> integer.h:16</div></div>
<div class="ttc" id="swappable_8h_html"><div class="ttname"><a href="swappable_8h.html">swappable.h</a></div></div>
<div class="ttc" id="class_integer_html_a6cf1eca614267c9a78a9d45b4dbb0bf6"><div class="ttname"><a href="class_integer.html#a6cf1eca614267c9a78a9d45b4dbb0bf6">Integer::Integer</a></div><div class="ttdeci">Integer(Integer &amp;&amp;in)</div><div class="ttdef"><b>Definition:</b> integer.h:17</div></div>
<div class="ttc" id="class_integer_html_a2ea2f60e46acea85fa4dd414dd9f9435"><div class="ttname"><a href="class_integer.html#a2ea2f60e46acea85fa4dd414dd9f9435">Integer::operator-</a></div><div class="ttdeci">Integer operator-() const</div><div class="ttdef"><b>Definition:</b> integer.hpp:352</div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_eec959d81771dc8b1a750b834e1341eb.html">emp-tool</a></li><li class="navelem"><a class="el" href="dir_2b4671b717884caf3b3fe5ce6896c1bb.html">circuits</a></li><li class="navelem"><a class="el" href="integer_8h.html">integer.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.12 </li>
  </ul>
</div>
</body>
</html>
